//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
/************************************************************************/
/*                                                                      */
/*                 TrueFFS Software Development Kit                     */
/*              Copyright (C) M-Systems Ltd. 1995-2005                  */
/*                                                                      */
/************************************************************************/

#ifndef BDCUSTOM_H
#define BDCUSTOM_H

/************************************************************************/
/************************************************************************/
/**                                                                    **/
/**    G E N E R A L   P A C K A G E  -  C U S T O M I Z A T I O N S   **/
/**                                                                    **/
/************************************************************************/
/************************************************************************/

/* Defines the package to be compiled.
 *
 * Normally the TrueFFS SDK is compiled, but if you want to compile only the
 * Boot SDK, uncomment the definition bellow.
 *
 * Note: The BDK requires the MTDSA.H and MTDSA.C files.
 */

/* #define MTD_STANDALONE */

/* Driver & TrueFFS Version numbers (Previously named OSAK)
 *
 * The string must not be greater than 10 characters.
 *
 * Note: Other then being returned by the the flVolumeInfo() routine this
 * value has no actual affect on the TrueFFS software.
 */

#define driverVersion   "OS Less"
#define OSAKVersion     "6.3.2"

#define FL_G3P3_BASED_DISKONCHIP
#define FL_G4_BASED_DISKONCHIP
/************************************************************************/
/************************************************************************/
/**                                                                    **/
/**             L I M I T S  -  C U S T O M I Z A T I O N S            **/
/**                                                                    **/
/************************************************************************/
/************************************************************************/

/* Number of sockets
 *
 * Defines the maximum number of supported physical DiskOnChip devices.
 *
 * The actual number of sockets depends on which socket controllers are
 * actually registered and the number of physical devices in the system.
 */

#define FL_SOCKETS 1

/* Number of volumes
 *
 * Defines the maximum number of supported Disk (BDTL) partitions.
 *
 * The actual number of drives depends on which socket controllers are
 * actually registered, the amount of devices in the system and the
 * flash format placed on each device.
 */

#define FL_VOLUMES  (6 * FL_SOCKETS)

 /* Number of Binary partitions on the DiskOnChip.
 *
 * Defines Maximum Number of supported Binary partitions.
 *
 * The actual number of partitions depends on the flash format placed
 * on each device.
 */

#define FL_BINARY_PARTITIONS (3 * FL_SOCKETS)

/* Maximum MTD's and Translation Layers
 *
 * Define here the maximum number of Memory Technology Drivers (MTD) and
 * Translation Layers (TL) that may be installed. Note that the actual
 * number installed is determined by which components are installed in
 * 'flRegisterComponents' (flcustom.c).
 */

#define FL_MTDS    5       /* Up to 3 MTD's */
#define FL_TLS     1       /* Up to 1 Translation Layers */

/* Disk partition cache
 *
 * Enable Block Device Translation Layer cache.
 *
 * Turning on this option improves performance but requires additional
 * RAM resources.
 *
 * The NAND Flash Translation Layer (NFTL , INFTL and SAFTL) are specifications
 * for storing data on the DiskOnChip in a way that enables accessing the
 * DiskOnChip as a Virtual Block Device. If this option is on, then the BDTL
 * keeps in RAM a table that saves some of the flash accesses.
 * Whenever it is needed to change table entry, the BDTL updates it in the
 * RAM table and on the DiskOnChip. If the TL has to read table entry, then you
 * can save time on reading sector from DiskOnChip.
 *
 * You can specify the number of units you would like to cache. The RAM required
 * for this operation is basically 2 bytes x the number of sectors per flash
 * unit. This size may change from one flash device to another.
 *
 * You can specify any number ranging from 1 to 0xFFF.
 */

#define FL_DEFAULT_TL_CACHE_SIZE(socket,partition) 64

/* TrueFFS Heap size.
 *
 * TrueFFS uses the FL_MALLOC and FL_FREE routines to allocate the memory it
 * requires. However if your native system does not have standard libraries,
 * for dynamic memory allocation you can use the TreuFFS implementation for
 * those routines called flMalloc and flFree.
 *
 * In such case you will need to define at compile time the heap size for
 * those routines using the following macro.
 */

#define  FL_TRUEFFS_HEAP_SIZE 200000

/* TrueFFS Heap pointer.
 *
 * The TrueFFS implementation of FL_MALLOC and FL_FREE routines allocates it's
 * heap as single large static array.
 *
 * It is also possible to specifically tell TrueFFS your preferred heap
 * location assuming that you are familiar with the physical memory of your
 * platform.
 */

/* #define  FL_TRUEFFS_HEAP_POINTER 0x80000000 */

/************************************************************************/
/************************************************************************/
/**                                                                    **/
/**     F E A T U R E S   IN / OUT  -  C U S T O M I Z A T I O N S     **/
/**                                                                    **/
/************************************************************************/
/************************************************************************/

/*
 * Remove all flash write functionalities from the code.
 *
 * When this option is selected, only API functions that do not involve write
 * operations to the media can be called.
 *
 * This option can be used to create read-only applications with low RAM/ROM
 * requirements.
 */

/* #define FL_READ_ONLY */

/* Flash Formatting (Block device format)
 *
 * Uncomment the following line if you need to prepare a virgin DiskOnChip
 * for work or in case you want to re-partition your existing device.
 *
 * This routine compiles the following 3 API routines:
 *    flFlashFormat(), flEraseBD() and flUnformat()
 */

#define FL_FORMAT_VOLUME

/* Absolute read & write
 *
 * Uncomment the following line if you want to be able to read & write
 * sectors by absolute sector number (i.e. without regard to files and
 * directories).
 */

#define FL_ABS_READ_WRITE

/* Environment Variables
 *
 * Enable environment variables control of the TrueFFS features.
 *
 */

/* #define FL_ENVIRONMENT_VARS */

/* IO Control Interface
 *
 * Support standard IOCTL interface. Used only by some block device drivers.
 *
 */

#define FL_IOCTL_INTERFACE

 /* Binary Partition
 *
 * Enables Binary partition manipulation.
 *
 */

#define BDK_ACCESS

#ifdef BDK_ACCESS

/* Remove Binary partition erase API */

/* #define BDK_REMOVE_ERASE_BDK_IMAGE */

/* Remove Binary partition create API */

/* #define BDK_REMOVE_CREATE_BDK_IMAGE */

/* Remove code used for binary partition partial page access
 *
 * Due to flash limitations, the binary partition requires special handling
 * to access (read and write) partial pages. When set this compilation flag
 * will remove the binary partition code and RAM buffers that handle partial
 * page access.
 */

/* #define FL_NO_BDK_PARTIAL_PAGE_ACCESS */

/* Compile the Binary partition read and write to file example code
 *
 * This compilation flag is relevant only for the BDK package.
 */

/* #define BDK_IMAGE_TO_FILE */

/* Compiles the code that calculates the checksum on the data read.
 *
 * This compilation flag is relevant only for the BDK package.
 */

/* #define BDK_CHECK_SUM */

#endif /* BDK_ACCESS */

/*
 * To keep accord with the kernel config
 */

#define FL_NO_QUICK_MOUNT_FEATURE

/*
 * This compilation flag has different meanings in TrueFFS SDK and Boot SDK.
 *
 * TrueFFS SDK - Removes the flReadBBT routine.
 *
 * Boot SDK    - Removes the support for none SPL partition handling.
 */

#define NO_READ_BBT_CODE

/* H/W OTP
 *
 * Enable H/W One Time Programming capability including the unique ID feature.
 *
 */

/* #define HW_OTP */

/* H/W Protection
 *
 * Enable H/W protection of the device.
 *
 */

#define HW_PROTECTION

/* Compile the code for reading after write
 *
 * Compiles the code and buffers for reading after every write operation
 * This mode is used for debugging when you are still debugging the platform's
 * H/W.
 */

/* #define FL_VERIFY_WRITE */

/* Verify entire volume
 *
 * Compile the flVerifyVolume() routine - this routine scans the entire disk
 * partition for power failures symptoms and correct them while initializing
 * the TL cache.
 *
 */

/* #define VERIFY_VOLUME */

/* Application exit
 *
 * If the TrueFFS application ever exits, it needs to call flEXit before
 * exiting. Uncomment the following line to enable this.
 */

#define FL_EXIT

/* Compile the extended Disk information routine
 *
 * TrueFFS 6.0 and up provide an extended information routine for internal
 * M-Systems utilities named flGetExtendedDiskInfo().
 * To compile its code define
 */

/* #define FL_EXTENDED_DISK_INFO */

/*
 * Removes the code used for writing and reading the IPL area.
 *
 */

/* #define NO_IPL_CODE*/

/* Disable the automatic argument check
 *
 * You can remove code and even slightly improve the overall performance by
 * allowing TrueFFS to skip its internal argument check by defining
 *
 */

/* #define FL_SKIP_ARGS_CHECK */

/* Fixed or removable media
 *
 * TrueFFS was originally designed for removable flash media.
 *
 * To remove the code dealing with the media removal simply uncomment
 */

#define FL_FIXED_MEDIA

/* Compile the auto DPD code
 *
 * TrueFFS supports a mode, where TrueFFS automatically enters and exit DPD
 * after every operation.
 *
 * The compilation bellow compiles that code. Note that it's operation is
 * also under the affect of the dedicated environment variable.
 */

/* #define FL_BD_AUTO_DPD_MODE */

/*
 * Compile the code for reporting the mount routine (progress call back)
 *
 */

/* #define FL_REPORT_MOUNT_PROGRESS */

/* Prevent the automatic recovery from reset assertion
 *
 * Usually TrueFFS will check if it is in reset mode before and after every
 * MTD operation to make sure no H/W changes were done to the device while
 * TrueFFS was not active.
 *
 * The normal mode of operation is to report this failure only if it occurred
 * in the middle of an MTD operation (found at the end of the operation).
 *
 * In case the failure was detected before the operation TrueFFS will try to
 * recover, assuming that the Platform has been put into some sort of a suspend
 * mode status and the user\driver has not initiated the proper S/W recovery
 * mechanisms.
 *
 * In case you do not trust your platform H/W you might want to remove this
 * protection to better debug it. This can be done by uncommenting the
 * compilation flag bellow.
 *
 * Please note that this mechanism is only a safety net, and the proper support
 * should be done by calling the TrueFFS recovery API's when returning
 * from the suspend mode.
 */

/* #define FL_NEVER_RECOVER_FROM_RST */

/* Fake Virtual RAM IPL support.
 *
 * When working with virtual RAM IPL's on platforms that do not connect the
 * BUSY signal to the CPU's hold input it is mandatory to enable this flag in
 * addition to customizing the FL_DELAY_MSEC macro.
 *
 * When using the virtual RAM IPL mode, the S/W must not access the
 * DiskOnChip memory window while the DiskOnChip controller is loading the
 * IPL pages to the memory window (happens automatically on power up).
 *
 * The above limitation is not a problem on the target platform that supports
 * the virtual RAM scheme (BUSY signal is connected to the CPU hold input).
 * However it is a real problem for other platforms as there is no indication
 * when the device has completed.
 *
 * Such a problem may occur when using Dformat or Dimage on an X86 or a
 * Programmer, preparing a device that contains virtual RAM not on the target
 * Platform
 */

/* #define FL_VRAM_FAKE_SUPPORT */

#endif /* BDCUSTOM_H */
